using System;
using L=Science.Physics.GeneralPhysics;

namespace Serway.Chapter10
{
	/// <summary>
	/// Example08: Applying the Parallel-Axis Theorem
	/// Consider once again the uniform rigid rod of mass M and 
	/// length L shown in Figure 10.10. Find the moment of inertia 
	/// of the rod about an axis perpendicular to the rod through 
	/// one end (the y's axis in Fig.10.10).
	/// I = 1/3 ML^2
	/// </summary>
	public class Example08
	{
		public Example08()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
			L.Mass m = new L.Mass();
			m.kg = 10.0;
			L.RigidBody rod = new L.RigidBody(m);
			L.Length l = new L.Length();
			l.m = 5.0;
			rod.SetRodAboutCenter(l);
			L.MomentOfInertia I = rod.RigidBodyMomentOfInertia;
			L.Length lh = new L.Length();
			lh.m = l.m/2.0;
			L.MomentOfInertia.ParallelAxisTheorem(I,L.UnitVector.j,m,lh);
            result+=Convert.ToString(I.YY)+"\r\n";
			result+=Convert.ToString(I.XX);
		}
	}
}
